package com.yjy.controller.vo3;


import com.yjy.util.ValidatorUtil;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
import java.util.Set;

public class PersonVo {

    @NotBlank(message = "用户名不能为空")
    @Length(min = 3, max = 8, message = "长度不正确")
    @Pattern(regexp = ValidatorUtil.REGEX_USERNAME, message = "用户名不包含中文和特殊字符")
    private String username;

    @Pattern(regexp = ValidatorUtil.REGEX_PASSWORD, message = "密码不包含特殊字符")
    private String password;

    @Pattern(regexp = ValidatorUtil.REGEX_MOBILE, message = "手机号格式有误")
    private String phone;

    @Email(message = "系统自带邮箱校验有误")
    private String email1;

    @Pattern(regexp = ValidatorUtil.REGEX_EMAIL, message = "自定义邮箱校验有误")
    private String email2;

    @Pattern(regexp = ValidatorUtil.REGEX_ID_CARD, message = "证件号码格式有误")
    private String identityNumber;

    @Min(value = 0, message = "年龄最小0")
    @Max(value = 120, message = "年龄最大120")
    private Integer age;

    @Negative(message = "只能负数")
    private Integer negative;

    @Positive(message = "只能正数")
    private Integer positive;

    @NegativeOrZero(message = "只能负数或0")
    private Integer negativeOrZero;

    @PositiveOrZero(message = "只能正数或0")
    private Integer positiveOrZero;

    // 级联对象必须不能为空和加@Vaid才能验证
    @Valid
    @NotNull(message = "信息不能为空")
    private Info info;

    public static class Info {

    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail1() {
        return email1;
    }

    public void setEmail1(String email1) {
        this.email1 = email1;
    }

    public String getEmail2() {
        return email2;
    }

    public void setEmail2(String email2) {
        this.email2 = email2;
    }

    public String getIdentityNumber() {
        return identityNumber;
    }

    public void setIdentityNumber(String identityNumber) {
        this.identityNumber = identityNumber;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getNegative() {
        return negative;
    }

    public void setNegative(Integer negative) {
        this.negative = negative;
    }

    public Integer getPositive() {
        return positive;
    }

    public void setPositive(Integer positive) {
        this.positive = positive;
    }

    public Integer getNegativeOrZero() {
        return negativeOrZero;
    }

    public void setNegativeOrZero(Integer negativeOrZero) {
        this.negativeOrZero = negativeOrZero;
    }

    public Integer getPositiveOrZero() {
        return positiveOrZero;
    }

    public void setPositiveOrZero(Integer positiveOrZero) {
        this.positiveOrZero = positiveOrZero;
    }

    public Info getInfo() {
        return info;
    }

    public void setInfo(Info info) {
        this.info = info;
    }
}
